package com.xrkj.miniprogram.client.service;



import core.data.DataHandle;
import core.validate.StringRule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xrkj.miniprogram.server.entity.RegistrationRequest;
import com.xrkj.miniprogram.server.entity.vo.RegistrationRequestVO;
import com.xrkj.miniprogram.server.mapper.RegistrationRequestMapper;


@Service
public class RegisterRequestService {
	
	@Autowired
	RegistrationRequestMapper mapper;
	
	@Transactional
	public void register(DataHandle<RegistrationRequestVO, ?> handle) {
		RegistrationRequestVO params = handle.getParams();
		RegistrationRequest registration=new RegistrationRequest();
		registration.setWxOpenid(params.getWxOpenid())
				.setNickname(params.getNickname())
				.setGroupName(params.getGroupName())
				.setPosition(params.getPosition())
				.setReason(params.getReason())
				.setPermitted(true);
		mapper.insert(registration);
		handle.success();
	}
}
